<template>
  <div>
    <div class="title_div">
      <div class="box">
        <div>添加成员</div>
        <el-button icon="el-icon-arrow-left" @click="goBack">返回</el-button>
      </div>
    </div>

    <div class="card_title">
      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <span>添加成员</span>
        </div>
        <div class="card_body">
          <el-form
            :model="ruleForm"
            :rules="rules"
            ref="ruleForm"
            :label-width="labelWidth"
          >
            <el-form-item label="成员名称" prop="designation">
              <el-input v-model="ruleForm.designation"></el-input>
            </el-form-item>

            <el-form-item label="成员姓名" prop="name">
              <el-input v-model="ruleForm.name"></el-input>
            </el-form-item>

            <el-form-item label="邮箱地址" prop="email">
              <el-input v-model="ruleForm.email"></el-input>
            </el-form-item>

            <el-form-item label="所属部门" prop="department">
              <el-select v-model="ruleForm.department" placeholder="全部">
                <el-option label="1" value="1"></el-option>
                <el-option label="2" value="2"></el-option>
              </el-select>
              <div class="text">
                选择所属部门后默认继承部门权限，可在成员列表中单独设置权限
              </div>
            </el-form-item>

            <el-form-item label="登录密码" prop="password">
              <el-input v-model="ruleForm.password"></el-input>
            </el-form-item>

            <el-form-item label="确认密码" prop="affirm">
              <el-input v-model="ruleForm.affirm"></el-input>
            </el-form-item>

            <el-form-item label="备注信息" prop="remarks">
              <el-input
                type="textarea"
                v-model="ruleForm.remarks"
                placeholder="请输入内容"
              ></el-input>
            </el-form-item>
          </el-form>
        </div>
        <div class="add_btn">
          <el-button type="success" style="background: #48c9b0">提交</el-button>
        </div>
      </el-card>
    </div>

    <!-- 页面下层数据 -->
      <div class="bottom">
        <div>Copyright © www.AxureUX.com, All Rights Reserved.</div>
        <div>Email: 5698401@qq.com QQ:5698401</div>
      </div>
  </div>
</template>

<script>
export default {
  name: "CodeAddMembers",

  data() {
    return {
      labelWidth: "40%",
      ruleForm: {
        designation: "",
        name: "",
        email: "",
        department: "",
        password: "",
        affirm: "",
        remarks: "",
      },
      rules: {
        designation: [
          { required: true, message: "请输入成员名称", trigger: "blur" },
          { min: 2, max: 6, message: "长度在 2 到 6 个字符", trigger: "blur" },
        ],
        name: [
          { required: true, message: "请输入成员姓名", trigger: "blur" },
          { min: 2, max: 4, message: "长度在 2 到 4 个字符", trigger: "blur" },
        ],
        email: [
          { required: true, message: "请输入有效的邮箱地址", trigger: "blur" },
        ],
        department: [
          { required: true, message: "请输入选择所属部门", trigger: "blur" },
        ],
        password: [
          { required: true, message: "请输入密码", trigger: "blur" },
          {
            min: 2,
            max: 11,
            message: "长度在 2 到 11 个字符",
            trigger: "blur",
          },
        ],
        affirm: [
          { required: true, message: "请确认密码", trigger: "blur" },
          {
            min: 2,
            max: 11,
            message: "长度在 2 到 11 个字符",
            trigger: "blur",
          },
        ],
      },
    };
  },

  mounted() {},

  methods: {
    // 返回
    goBack() {
      this.$router.go(-1);
    },
  },
};
</script>

<style lang="less" scoped>
.title_div {
  background: #f3f3f3;
  height: 50px;
  display: flex;
  justify-content: space-around;
  border-bottom: 1px solid #e4e4e4;
}

.box {
  width: 85%;
  display: flex;
  justify-content: space-between;
  align-items: center;

  .el-button {
    height: 40px;
  }

  div {
    height: 15px;
    line-height: 15px;
    border-left: 6px solid #1abc9c;
    padding: 4px;
  }
}
.card_title {
  display: flex;
  justify-content: space-around;
}
.box-card {
  width: 85%;
  margin: 20px 0;
}
.clearfix {
  display: flex;
  justify-content: space-between;
}
/deep/.el-card__header {
  background: #f3f3f3;
}
.el-input {
  width: 30%;
}
.add_btn {
  width: 100%;
  text-align: center;
  margin-left: -7.4%;
}
/deep/textarea {
  width: 70%;
  height: 200px;
}
.text {
  font-size: 12px;
  color: #999999;
}
.el-form {
  text-align: left;
}
.bottom {
  width: 100%;
  height: 100px;
  font-size: 14px;
  color: rgb(218, 218, 218);
  text-align: center;
}
</style>